package com.example.springbootredis.controller;

import com.example.springbootredis.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class TestController {
    @Autowired
    private RedisUtil redisUtil;

    @GetMapping("/redis/save")
    public String save() {
        redisUtil.set("name", "zhangsan1");
        Map map = new HashMap<>();
        map.put("age", 20);
        map.put("address", "beijing");
        redisUtil.hmput("user", map);
        return null;
    }
    @GetMapping("/redis/delete")
    public String delete() {
        redisUtil.delete("name");
        redisUtil.delete("user");
        return null;
    }
}
